﻿#region Copyright (C) Sector7 Software Studio. All rights reserved
/*******************************************************************************************
 * Creation
 *      Author:         Wolf Lai
 *      Date:           2013/11/3 星期日 23:19:49
 *      Version:        
 * Modification 
 *      Author: 
 *      Date: 
 *      Description: 
 *      Version:
 *******************************************************************************************/
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Sector7.Framework.Consts
{
    /// <summary>
    /// 错误码常量定义
    /// </summary>
    public class C_ErrorCode
    {
        #region 系统运行错误码（710）
        public const int ERR_SYS_SUCCESS = 710000;
        public const int ERR_SYS_INVALID_PARAM = 710001;
        public const int ERR_SYS_NULL_STRING = 710002;
        public const int ERR_SYS_NULL_OBJECT = 710003;
        public const int ERR_SYS_FILE_NOT_FOUND = 710004;
        #endregion

        #region 帐号操作错误码（711）
        public const int ERR_ACC_SUCCESS = ERR_SYS_SUCCESS;
        public const int ERR_ACC_EXIST = 711001;
        public const int ERR_ACC_UNKNOWN_ROLE = 711101;
        public const int ERR_ACC_NOT_MATCH = 711102;
        #endregion

        #region 数据库操作错误码（712）
        public const int ERR_DB_SUCCESS = ERR_SYS_SUCCESS;
        public const int ERR_DB_FAILURE = 712002;
        #endregion

        #region Public functions
        /// <summary>
        /// 根据错误码获取错误信息
        /// </summary>
        /// <param name="errorCode">错误码</param>
        /// <returns></returns>
        public static string ToString(int errorCode)
        {
            string errorMessage = string.Empty;

            switch (errorCode)
            {
                case ERR_ACC_UNKNOWN_ROLE:
                    errorMessage = "未知角色类型！";
                    break;
                case ERR_ACC_NOT_MATCH:
                    errorMessage = "用户名密码不匹配！";
                    break;
                default:
                    break;
            }

            return errorMessage;
        }
        #endregion
    }
}
